package com.shinhye.wisdompeking.base;

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
import com.shinhye.wisdompeking.MainActivity;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public abstract class BaseFragment extends Fragment {
	private SlidingMenu slidingMenu;
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		slidingMenu = ((MainActivity) getActivity()).getMenu();
	}
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View view = initView(inflater);
		return view;
	}
	
	public SlidingMenu getMenu() {
		return slidingMenu;
	}
	
	public MainActivity getMainActivity() {
		return ((MainActivity) getActivity());
	}

	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		initData(savedInstanceState);
		super.onActivityCreated(savedInstanceState);
	}
	
	public abstract void initData(Bundle savedInstanceState);
	public abstract View initView(LayoutInflater inflater);
}
